The ModelConfiguration is what you are looking for. I do not get chance to try it, but the WWDC video shows the way like:
let people = ModelConfiguration(..., cloudKitContainerIdentifier: "com.xxx.xxx")
let container = try ModelContainer(for: ..., people)
I understand that SwiftData is a set of swift classes. However, I have some concerns about using them directly in the UI, as shown in the videos and the examples. This may lead to some problems:
Performance issue. For instance, if a record contains some images, how can I handle them efficiently with SwiftData? I don't want to load all the image data in memory, but rather cache them in files and load the URL in the view model.
Complicated logic. Using SwiftData models in the UI may be convenient for coding, but sometimes the logic may become too complex. We may need to create other view models based on the basic models. But SwiftData is not a lightweight variable, and I don't know how to track the changes of the SwiftData models in other custom @Observeable models.
I have no more CoreData experience, would you please help to suggest the way to use SwiftData for my preceding concerns?